﻿using System.Collections.Generic;
using System.Linq;

namespace Inscriptionem.Areas.Inscriptionem.Models.Views
{
    public class RegistrationSearchCollectionViewModel
    {
        public IEnumerable<ORM.Member> Members { get; protected set; }

        public RegistrationSearchCollectionViewModel()
        {
            Members =
                new ORM.DB().Members.Where(m => !m.IsRegistrationApproved && !m.IsReadOnly).Where(
                    m =>
                    m.FirstName.ToLower().Contains(Text.ToLower()) || m.NickName.ToLower().Contains(Text.ToLower()) || m.LastName.ToLower().Contains(Text.ToLower()) ||
                    m.Mail.ToLower().Contains(Text.ToLower())).OrderBy(m => m.ID);
        }

        public string Text { get; set; }
        public int Page { get; set; }
    }
}